<%@ Page language="c#"MasterPageFile="../masterpages/umbracoDialog.Master" Codebehind="uploadImage.aspx.cs" AutoEventWireup="True" Inherits="umbraco.dialogs.uploadImage" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

		<script language="javascript">
		
			function validateImage() {
				// Disable save button
			    document.getElementById("ctl00_body_Button1").disabled = true;
				var imageTypes = ",jpeg,jpg,gif,bmp,png,tiff,tif,";

				var imageName = document.getElementById("ctl00_body_uploadFile").value;
				if (imageName.length > 0) {
				    var extension = imageName.substring(imageName.lastIndexOf(".") + 1, imageName.length);
				    if (imageTypes.indexOf(',' + extension.toLowerCase() + ',') > -1) {
				        document.getElementById("ctl00_body_Button1").disabled = false;
				        document.getElementById("ctl00_body_TextBoxTitle").value = imageName.substring(imageName.lastIndexOf("\\") + 1, imageName.length).replace("." + extension, "");
					}
				}
			}
			
			function chooseId() {
				var treePicker = window.showModalDialog('<%=umbraco.cms.presentation.Trees.TreeService.GetPickerUrl(true,"media","media")%>', 'treePicker', 'dialogWidth=350px;dialogHeight=300px;scrollbars=no;center=yes;border=thin;help=no;status=no')			
				if (treePicker != undefined) {
				    document.getElementById("ctl00_body_folderid").value = treePicker;
					if (treePicker > 0) {
						umbraco.presentation.webservices.CMSNode.GetNodeName('<%=umbraco.BasePages.BasePage.umbracoUserContextID%>', treePicker, updateContentTitle);
					}				
				}
			}			
			function updateContentTitle(result) {
				document.getElementById("mediaTitle").innerHTML = "<strong>" + result + "</strong>";
			}
		</script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="body" runat="server">


			<asp:Panel id="Panel1" runat="server">
				<P>
					<TABLE class="propertyPane" id="Table1" cellSpacing="0" cellPadding="4" width="98%" border="0">
						<TR>
							<TD class="propertyHeader" width="30%">
								<asp:Literal id="LiteralTitle" runat="server"></asp:Literal>:
							</TD>
							<TD class="propertyContent">
								<asp:TextBox id="TextBoxTitle" runat="server"></asp:TextBox>
								<P></P>
							</TD>
						</TR>
						<TR>
							<TD class="propertyHeader" width="30%">
								<asp:Literal id="LiteralUpload" runat="server"></asp:Literal>:
							</TD>
							<TD class="propertyContent">
								<asp:PlaceHolder id="PlaceHolder1" runat="server"></asp:PlaceHolder>
								<P></P>
							</TD>
						</TR>
						<TR>
							<TD class="propertyHeader" width="30%">
								<P class="guiDialogNormal">Save in folder:
								</P>
							</TD>
							<TD class="propertyContent">
                                <asp:PlaceHolder ID="mediaPicker" runat="server"></asp:PlaceHolder>							
								<P></P>
								<P>
									<asp:Button id="Button1" runat="server" Enabled="False" Text="Button" onclick="Button1_Click"></asp:Button></P>
						</TR>
					</TABLE>
			</asp:Panel>
			<asp:Panel id="Panel2" runat="server" Visible="False">
				<div style="padding:10px;">
				<b><asp:literal ID="thumbnailtext" Runat="server"></asp:literal></b>
				<br /><br />
				<IMG id="uploadedimage" src="" runat="server">
				</div>
			</asp:Panel>

</asp:Content>
  